package io.zhiller.storagedemo.storage.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy.Companion.REPLACE
import androidx.room.Query
import androidx.room.Upsert
import io.zhiller.storagedemo.storage.domain.Note
import kotlinx.coroutines.flow.Flow

@Dao
interface NoteDAO {
  @Insert(onConflict = REPLACE)
  fun insert(values: List<Note>)

  @Upsert
  suspend fun upsertNote(note: Note)

  @Delete
  suspend fun deleteNote(note: Note)

  @Query("SELECT * FROM note_table")
  fun getAllNotes(): Flow<List<Note>>
}